/**
 * FileName: ComMsg
 * Author: Administrator
 * Date: 2018/11/20 20:34
 * Description: 这是一个json提示的通用信息类
 */
package com.cym.utils;

import java.util.HashMap;
import java.util.Map;

public class ComMsg {
    //成功：666 失败：555
    private int code;
    private String message;
    private Map<String,Object> extend = new HashMap<String,Object>();

    public static ComMsg success(){
        ComMsg msg = new ComMsg();
        msg.setCode(666);
        msg.setMessage("处理成功！");
        return msg;
    }
    public static ComMsg fail(){
        ComMsg msg = new ComMsg();
        msg.setCode(555);
        msg.setMessage("处理失败！");
        return msg;
    }

    public ComMsg add(String key,Object value){
        this.getExtend().put(key,value);
        return this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Map<String, Object> getExtend() {
        return extend;
    }

    public void setExtend(Map<String, Object> extend) {
        this.extend = extend;
    }
}
